package net.mikoo.seals.common.result;

import java.io.Serializable;
import java.util.Map;

/**
 * 
 * @author huangxm
 *
 * @param <T>
 */
public interface Result<T> extends Serializable {
	
	/** 操作成功 */
	public final static String SUCCESS = "0";
	
	/** 系统出错 */
	public final static String SYSTEM_ERROR = "-1";
	
	/** 非法参数 */
	public static final String ILLEGAL_PARAMETER = "1";
	
	/** 非法操作 */
	public static final String ILLEGAL_OPERATION = "3";
	
	/** 登录帐户已存在 */
	public final static String USERNAME_EXISTS = "10001";
	
	/** 手机号码已存在 */
	public static final String MOBILE_EXISTS = "10002";
	
	/** 邮箱已存在 */
	public static final String EMAIL_EXISTS = "10003";
	
	/** 登录帐户被禁用 */
	public final static String USERNAME_DISABLED = "10004";
	
	/** 登录帐户被冻结 */
	public final static String USERNAME_FREEZED = "10005";
	
	/** 登录帐户已过期 */
	public final static String USERNAME_EXPIRY = "10006";
	
	/** 登录帐户不存在 */
	public final static String USERNAME_NOT_EXISTS = "10007";
	
	/** 登录密码错误 */
	public final static String PASSWORD_ERROR = "10008";
	
	
	
	public final static String PARTY_TYPE_IS_EMPTY = "party_type_is_empty";
	
	public final static String PARTY_STATUS_IS_EMPTY = "party_status_is_empty";
	
	
	
	
	
	
	
	
	
	
	/** 验证码错误 */
	public final static String AUTHCODE_ERROR = "100009";
	
	
	
	/** 上传失败*/
	public static final String UPLOAD_ERROR = "900001";
	
	public static final String CATEGORY_EXIST_CHAILD  = "category_exist_chaild ";
	
	
	
	
	public static final String PAYMENT_STATUS_ERROR = "800001";
	
	/*public static final int SUCCUESS = 0;
	
	public static final int MISSING_PARAMETER = 1000;
	public static final int VALIDATE_PARAMETER = 1001;
	public static final int PARAMETER_BLANK = 1002;
	
	public static final int TOKEN_ERROR = 1002;
	
	public static final int METHOD_NOT_SUPPORT = 2000;
	
	public static final int LOGIN_USER_NOT_EXIST = 3000;
	public static final int LOGIN_USER_PASSWD_ERROR = 3001;
	public static final int PAYPASSWORD_ERROR = 3003;
	public static final int REGIST_USER_DUP_ERROR = 4001;
	public static final int LOGIN_SYSTEM_ERROR = 3002;
	
	//public static final int SYSTEM_ERROR = 9000;
	public static final int SYSTEM_SESSION_TIMEOUT = 9001;
	public static final int DB_SQL_ERROR = 9002;
	
	public static final int CONFIG_ERROR = 9003;
	public static final int CURRENT_STATUS_CANT_EDIT_ERROR = 9004;
	public static final int NO_APP_UPDATE_ERROR = 9005;
	public static final int NO_SUCH_USER = 9006;
	public static final int DONOT_NEED_UPDATE_DATABASE = 9007;
	public static final int PARENT_CUSTOMER_NOT_EXIST = 9008;
	public static final int CUSTOMER_NOT_EXIST = 9009;
	public static final int DB_SQL_NOT_UPDATE = 9010;
	public static final int PERMISSION_DENIED = 9011;
	public static final int UPLOAD_FILE_ERROR = 9012;
	public static final int ATTACHMENT_NOT_EXIST = 9013;
	public static final int EMAIL_ALREADY_EXIST = 9014;
	public static final int SAFECODE_INCORRECT = 9015;
	public static final int INVITATION_CODE_NOT_EXIST = 9100;
	public static final int INVITATION_REGISTER_ERROR = 9101;
	public static final int INVITATION_ACCOUNT_ALREADY_EXIST = 9102;
	public static final int MOBILE_HAS_EXIST = 9103;
	public static final int NOT_AVAILABLE = 9104;*/
	
	
	
	
	/**
	 * 请求是否成功。
	 * 
	 * @return 如果成功，则返回<code>true</code>
	 */
	public boolean isSuccess();

	/**
	 * 设置请求成功标志。
	 * 
	 * @param success
	 *            成功标志
	 */
	public void setSuccess(boolean success);

	/**
	 * 获取返回码
	 * 
	 * @return 返回码
	 */
	public String getCode();

	/**
	 * 设置返回码
	 * 
	 * @param code
	 */
	public void setCode(String code);

	/**
	 * 设置结果信息
	 * 
	 * @param msg
	 */
	public void setMessage(String message);

	/**
	 * 返回结果信息
	 * 
	 * @return
	 */
	public String getMessage();

	/**
	 * <p>
	 * 设置 model 对象。key 置为对象 class 类名
	 * </p>
	 * 
	 * @param model
	 */
	public void setModel(T model);

	/**
	 * <p>
	 * 从 models 中获取指定类的 model 对象
	 * </p>
	 * 
	 * @return
	 */
	public T getModel();

	public void setResult(boolean success, T model, String code, String message);

	public void setResult(boolean success, String code, String message);
	
	public Map<String,String> getMapResult();
}
